package com.demo.service.impl;

import com.demo.common.ServiceException;
import com.demo.entity.RoleEntity;
import com.demo.mapper.IRoleMapper;
import com.demo.service.IRoleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @author libo
 * @version 1.0
 * @date 2018/4/26 17:15
 */
@Transactional
@Service
public class RoleServiceImpl implements IRoleService {
    public static final Logger LOGGER = LoggerFactory.getLogger(RoleServiceImpl.class);

    @Autowired
    private IRoleMapper roleMapper;

    @Override
    public Long save(RoleEntity entity) throws ServiceException {
        return roleMapper.save(entity);
    }

    @Override
    public Integer update(RoleEntity entity) throws ServiceException {
        return roleMapper.update(entity);
    }

    @Override
    public Integer remove(Long pkId) throws ServiceException {
        return roleMapper.remove(pkId);
    }

    @Override
    public RoleEntity get(Long pkId) throws ServiceException {
        return roleMapper.get(pkId);
    }

    @Override
    public List<RoleEntity> listByQuery(Map<String, Object> params) throws ServiceException {
        return roleMapper.listByQuery(params);
    }
}
